package request

import "time"

// GetFinancialStatsRequest 获取财务统计数据请求
type GetFinancialStatsRequest struct {
	StartDate string `json:"start_date" form:"start_date" binding:"required" example:"2024-01-01"`
	EndDate   string `json:"end_date" form:"end_date" binding:"required" example:"2024-01-31"`
	Type      string `json:"type" form:"type" binding:"omitempty" example:"daily"` // daily, weekly, monthly
}

// GetFinancialSummaryRequest 获取财务汇总信息请求
type GetFinancialSummaryRequest struct {
	StartDate string `json:"start_date" form:"start_date" binding:"required" example:"2024-01-01"`
	EndDate   string `json:"end_date" form:"end_date" binding:"required" example:"2024-01-31"`
}

// GetIncomeBreakdownRequest 获取收入明细请求
type GetIncomeBreakdownRequest struct {
	StartDate string `json:"start_date" form:"start_date" binding:"required" example:"2024-01-01"`
	EndDate   string `json:"end_date" form:"end_date" binding:"required" example:"2024-01-31"`
	Category  string `json:"category" form:"category" binding:"omitempty"`
	Page      int    `json:"page" form:"page" binding:"omitempty,min=1" example:"1"`
	PageSize  int    `json:"page_size" form:"page_size" binding:"omitempty,min=1,max=100" example:"20"`
}

// GetExpenseBreakdownRequest 获取支出明细请求
type GetExpenseBreakdownRequest struct {
	StartDate string `json:"start_date" form:"start_date" binding:"required" example:"2024-01-01"`
	EndDate   string `json:"end_date" form:"end_date" binding:"required" example:"2024-01-31"`
	Category  string `json:"category" form:"category" binding:"omitempty"`
	Page      int    `json:"page" form:"page" binding:"omitempty,min=1" example:"1"`
	PageSize  int    `json:"page_size" form:"page_size" binding:"omitempty,min=1,max=100" example:"20"`
}

// GetTransactionListRequest 获取交易明细列表请求
type GetTransactionListRequest struct {
	StartDate string `json:"start_date" form:"start_date" binding:"required" example:"2024-01-01"`
	EndDate   string `json:"end_date" form:"end_date" binding:"required" example:"2024-01-31"`
	Type      string `json:"type" form:"type" binding:"omitempty"` // income, expense, all
	Status    string `json:"status" form:"status" binding:"omitempty"`
	Page      int    `json:"page" form:"page" binding:"omitempty,min=1" example:"1"`
	PageSize  int    `json:"page_size" form:"page_size" binding:"omitempty,min=1,max=100" example:"20"`
}

// FinancialStats 财务统计数据结构
type FinancialStats struct {
	Date      string  `json:"date"`       // 日期
	Income    float64 `json:"income"`     // 收入
	Expense   float64 `json:"expense"`    // 支出
	NetProfit float64 `json:"net_profit"` // 净利润
}

// FinancialSummary 财务汇总数据结构
type FinancialSummary struct {
	TotalIncome    float64 `json:"total_income"`     // 总收入
	TotalExpense   float64 `json:"total_expense"`    // 总支出
	TotalNetProfit float64 `json:"total_net_profit"` // 总净利润
	IncomeRate     float64 `json:"income_rate"`      // 收入增长率
	ExpenseRate    float64 `json:"expense_rate"`     // 支出增长率
	TopSource      string  `json:"top_source"`       // 最大收入来源
	TopExpense     string  `json:"top_expense"`      // 最大支出项
}

// TransactionItem 交易明细项结构
type TransactionItem struct {
	ID        string    `json:"id"`
	Type      string    `json:"type"`
	Amount    float64   `json:"amount"`
	UserID    string    `json:"user_id"`
	Timestamp time.Time `json:"timestamp"`
	Status    string    `json:"status"`
	Remark    string    `json:"remark"`
}

// IncomeBreakdown 收入明细结构
type IncomeBreakdown struct {
	Source     string  `json:"source"`     // 来源
	Amount     float64 `json:"amount"`     // 金额
	Percentage float64 `json:"percentage"` // 占比
	Count      int     `json:"count"`      // 笔数
}

// ExpenseBreakdown 支出明细结构
type ExpenseBreakdown struct {
	Category   string  `json:"category"`   // 类别
	Amount     float64 `json:"amount"`     // 金额
	Percentage float64 `json:"percentage"` // 占比
	Count      int     `json:"count"`      // 笔数
}
